import request from '@/utils/request'

export function paginate(form, page, page_size) {
  return request({
    url: '/api/sys/app/paginate',
    method: 'post',
    data: {
      page_num: page,
      page_size: page_size,
      user_token: form.user_token,
      app_name: form.app_name
    }
  })
}

export function save(form) {
  return request({
    url: '/api/sys/app/save',
    method: 'post',
    data: {
      app_name: form.app_name,
      user_type: form.user_type,
      expire_time: form.expire_time,
      add_secret: form.add_secret,
      user_token: form.user_token,
      token_expire: form.token_expire,
      restrict_access: form.restrict_access,
      restrict_platform: form.restrict_platform
    }
  })
}

export function update(form) {
  return request({
    url: '/api/sys/app/update',
    method: 'post',
    data: {
      app_id_ex: form.app_id_ex,
      app_name: form.app_name,
      user_type: form.user_type,
      expire_time: form.expire_time,
      add_secret: form.add_secret,
      user_token: form.user_token,
      token_expire: form.token_expire,
      restrict_access: form.restrict_access,
      restrict_platform: form.restrict_platform
    }
  })
}

export function cache() {
  return request({
    url: '/api/sys/app/cache',
    method: 'post',
    data: { }
  })
}

export function secret(app_id_ex) {
  return request({
    url: '/api/sys/app/secret',
    method: 'post',
    data: {
      app_id_ex: app_id_ex
    }
  })
}
